jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

Windows file tasks with drive letter break #318

Open markandrus opened 8 years ago

markandrus commented 8 years ago

Hi!

If you create a file task that includes a drive letter, for example

file('C:\foo', function() {
  // Do something
});

task('bar', ['C:\foo']);

then trying to run bar will fail. I discovered this after writing a bunch of platform-independent code using path.resolve, only to find it failed on Windows.

This issue is related to #252, but I think it might warrant a separate ticket since the issue seems more serious than if ":" were simply disallowed in tasks.

Thanks, Mark

markandrus commented 8 years ago

I think the issue has to do with the way we split on ":" here.

welearnednothing commented 8 years ago

Thanks Mark! For completeness, can you include a sample error as well?

On May 23, 2016, at 20:30, Mark Roberts notifications@github.com wrote:

Hi!

If you create a file task that includes a drive letter, for example

file('C:\foo', function() { // Do something });

task('bar', ['C:\foo']); then trying to run bar will fail. I discovered this after writing a bunch of platform-independent code using path.resolve, only to find it failed on Windows.

This issue is related to #252, but I think it might warrant a separate ticket since the issue seems more serious than if ":" were simply disallowed in tasks.

Thanks, Mark

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

markandrus commented 8 years ago

@welearnednothing sure thing. Here's a sample Jakefile

var fs = require('fs');
var path = require('path');

var foo = path.join(__dirname, 'foo');

file(foo, function() {
  fs.closeSync(fs.openSync(foo, 'w'));
});

task('bar', [foo]);

When I run it on Windows, I get

C:\Users\mrobe\test-jake>jake bar
jake aborted.
Error: Unknown task "C:\Users\mrobe\test-jake\foo"
    at TaskBase.nextPrereq (C:\Users\mrobe\test-jake\node_modules\jake\lib\task\task.js:181:15)
    at TaskBase.runPrereqs (C:\Users\mrobe\test-jake\node_modules\jake\lib\task\task.js:155:14)
(See full trace by running task with --trace)

whereas on OS X it works fine.

mde commented 8 years ago

@markandrus I've added you to the org -- use your commit-bit powers for good!

yosheeck commented 6 years ago

Causing trouble also for me/us on Windows machines. Just saying it will be useful to have a fix.