Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

CLI: source-map option preventing stderr #361

Closed
am11 opened this issue Jul 1, 2014 · 7 comments · Fixed by #366
Closed

CLI: source-map option preventing stderr #361

am11 opened this issue Jul 1, 2014 · 7 comments · Fixed by #366

Comments

@am11
Copy link
Contributor

am11 commented Jul 1, 2014

/cc madskristensen/WebEssentials2013#1268

In foo.scss:

body{color:red;

(missing closing mustache)

Now running the following command:

node.exe tools\node_modules\node-sass\bin\node-sass "C:\temp\foo.scss"

will produce the error:

C:\temp\foo.scss:1: error: invalid property name

But running:

node.exe tools\node_modules\node-sass\bin\node-sass --source-map "c:\temp\foo.css.map" "C:\temp\foo.scss"

with --source-map option digests the error message.

@Francisc
Copy link

This is so annoying, please fix it.

@10xLaCroixDrinker
Copy link
Contributor

👍

@am11
Copy link
Contributor Author

am11 commented Jul 11, 2014

It think it goes upstream somewhere out of the context of node.js section of node-sass.

On calling binding.render() or binding.renderFile() with the invalid content and sourceMap: mapFileName,, the call doesn't returns back but exits the node process entirely.

Here is another way to reproduce it using REPL:

With sourceMap commented:

c:\temp> type c:\temp\foo.scss
body{color:red;

a::before {
    width: 10px;
    height: 10px
}
c:\temp> node
> require("node-sass").render({
...     file: "c:/temp/foo.scss",
...     includePaths: ["c:/temp/foo.scss"],
...     outputStyle: 'expanded',
...     //sourceMap: "C:/temp/fooMap.css.map",
...     success: function (css, map) { console.log(css);console.log(map);},
...     error: function (error) {console.log(error);}
... });
undefined
> c:/temp/foo.scss:12: error: invalid property name


undefined
>

Node.exe is still running.

Reattempting with uncommented sourceMap:

> require("node-sass").render({
...     file: "c:/temp/foo.scss",
...     includePaths: ["c:/temp/foo.scss"],
...     outputStyle: 'expanded',
...     sourceMap: "C:/temp/fooMap.css.map",
...     success: function (css, map) { console.log(css);console.log(map);},
...     error: function (error) {console.log(error);}
... });
undefined
>
C:\temp>

Process terminated abruptly. I tried to catch exception, used require("domain"), overridden process.exit, process.kill and process.abort but nothing seems to stop it from terminating the process. Not even the process.on("exit/kill/abort", cb) and process.on("uncaughtException", cb).

Can anyone please confirm if this is a Windows-only issue? /cc @andrew, @nschonni

One last note, the issue doesn't occurs when we call require("node-sass").renderFile() which ultimately calls binding.render() (as opposed to binding.renderFile(); its reciprocal). (actually it does :))

@am11
Copy link
Contributor Author

am11 commented Jul 11, 2014

Ok just test tested with Ubuntu 12.04 LTS via vagrant and guess what, "Segmentation Fault" strikes again! 🚄

vagrant@precise64:/work$ node
> require("node-sass").render({
...     file: "/vagrant_data/foo.scss",
...     includePaths: ["/vagrant_data/foo.scss"],
...     outputStyle: 'expanded',
...     //sourceMap: "/vagrant_data/fooMap.css.map",
...     success: function (css, map) { console.log(css);console.log(map);},
...     error: function (error) {console.log(error);}
... });
undefined
> /vagrant_data/foo.scss:12: error: invalid property name


undefined
> require("node-sass").render({
...     file: "/vagrant_data/foo.scss",
...     includePaths: ["/vagrant_data/foo.scss"],
...     outputStyle: 'expanded',
...     sourceMap: "/vagrant_data/fooMap.css.map",
...     success: function (css, map) { console.log(css);console.log(map);},
...     error: function (error) {console.log(error);}
... });
undefined
> Segmentation fault
vagrant@precise64:/work$

In Windows, it even digests this error message.

@LostSenSS
Copy link

👍

@am11
Copy link
Contributor Author

am11 commented Jul 11, 2014

Sorry for bugging you guys again. 😃

Could it be the issue with node-sass, particularly the way it allocates memory? I tried using new with binding, but as those node-qt guys stated, its a tough luck.. :(

"Segmentation fault"

Tough luck :) Did you forget to new a wrapped object?

@am11
Copy link
Contributor Author

am11 commented Jul 14, 2014

This is fixed by adb6baf via #366.

@andrew @nschonni please review.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants