-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ToolRunner.exec does not work on Windows when both toolPath and arguments contain spaces #112
Comments
Can you repro an issue with the task-lib with lib >= 0.8 (we're currently on 0.9.x)? |
I confirmed the task-lib >= 0.8 does not have the issue. The issue is the gulp task is shipping 0.7 (old) version of the task lib. > var tl = require('vsts-task-lib/task');
##vso[task.debug]agent.workFolder=undefined
##vso[task.debug]loading inputs and endpoints
##vso[task.debug]loaded 0
> var tr = tl.tool('gulp');
> tr.arg('/path/with spaces/in/it');
> tr.args
[ '/path/with spaces/in/it' ]
> The key is the path intact with spaces needs to get into process argv with spaces and without double quotes. We will update the gulp task to use 0.9 |
You're faster than I am. Does your Gulp path also have spaces? Because that is the only way to fully reproduce this. Your test code only covers the argument, not the path that is passed to |
To be specific, I don't see this error addressed yet:
This would be explained by the nodejs bug I linked above... |
Hmmm. With new lib. node 4.4.6 test.sh just does
~/Testing/space path$ npm install vsts-task-lib
~/Testing/space path$ node
> var tl = require('vsts-task-lib/task');
##vso[task.debug]agent.workFolder=undefined
##vso[task.debug]loading inputs and endpoints
##vso[task.debug]loaded 0
> var p = '/Users/bryan/Testing/space path/test.sh'
> var tr=tl.tool(p);
> tr.arg('/arg one/here');
> tr.exec(function() { console.log('done');});
##vso[task.debug]exec tool: /Users/bryan/Testing/space path/test.sh
##vso[task.debug]Arguments:
##vso[task.debug] /arg one/here
[command]/Users/bryan/Testing/space path/test.sh /arg one/here
{ state: 'pending' }
> arg 1: /arg one/here
##vso[task.debug]rc:0
##vso[task.debug]success:true |
It looks like you're running this on a Mac, where there is no issue. It only fails on Windows. |
Yeah - that was my next step. I'm OOF on laptop/wifi. Will try when I'm back in office. If that is the case then because toolPath is known to be a path, we can quote if not already quoted. Then gulp would have to pickup latest task-lib. I'll try and produce private in the morning when @ desk. |
quoting messes up on osx so if we do the workaround, might have to be win only. will validate in a.m. |
I'll add unit tests as well. Good thing is we run them on all platforms. |
todo: add middle-man process to tl.exec when on Windows |
..then fix gulp task |
fixed by PR #157 |
Use case and traces: microsoft/azure-pipelines-tasks#2253
It looks like this is caused by nodejs/node#7367.
Manually patching the build agent fixes this (javascript resulting from https://github.com/Microsoft/vsts-task-lib/blob/master/node/toolrunner.ts#L232, slightly rewritten to remove typescript-specific syntax):
(clearly wrapping args in double quotes is a hack, this is just to prove the point - without that
Gulpfile.js
still is not found).The text was updated successfully, but these errors were encountered: