Skip to content
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

Support unc paths for command execution #784

Merged
merged 9 commits into from
May 25, 2016
Merged

Conversation

mjbvz
Copy link
Contributor

@mjbvz mjbvz commented Mar 29, 2016

Defect
#755 Unc paths cause a problem currently when running commands .

Fix
Use pushd to set the working directory when running a command. Tested by opening a project from \\localhost\c$.

closes #755

QuoteSingleArgument(outFile),
QuoteSingleArgument(errFile)
);
psi.WorkingDirectory = workingDirectory;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm... I'm concerned about the implications of not setting the WorkingDirectory property. In particular, the working directory property has different implications depending on the value of UseShellExecute. Did you verify the edge cases here?
https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.workingdirectory(v=vs.110).aspx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried testing the edge cases I could think of, but this is widely used code that is also shared with common so I'm sure I missed some areas. My understanding is that pushd replaces the need to set the working directory for executing the actual command. We are only relying on the initial, default working directory to pick up cmd.exe.

Any specific edge cases you had in mind?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, see the UseShellExecute stuff in the link above. In particular...

When the UseShellExecute property is false, gets or sets the working directory for the process to be started. When UseShellExecute is true, gets or sets the directory that contains the process to be started.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my question is more: what testing would make you more confident in the change?

I generally understand what UseShellExecute and WorkingDirectory do, but also believe that, with this change, working directory is only going to be used directly for looking up cmd.exe. Once we actually run node ..., pushd has already changed the working directory.

I verified all the basic scenarios against this change, while also running node programs to look at process.cwd() and opening relative file paths. Any other thoughts?

QuoteSingleArgument(filename),
GetArguments(arguments, quoteArgs)),
CreateNoWindow = !visible,
UseShellExecute = false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvrmind, reverted the suggested fix. This has to be false because we set the Redirect* properties. The elevated example manually redirects to a file, which is why it can get away with setting this to true.

@mjbvz mjbvz merged commit f9f6221 into microsoft:master May 25, 2016
@mousetraps mousetraps mentioned this pull request Jun 8, 2016
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support UNC paths when running processes
3 participants