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

StartProcess cannot find specified file using native StartProcess or using Powershell version. #2105

Closed
jenaewhitmore opened this issue Mar 30, 2018 · 3 comments

Comments

@jenaewhitmore
Copy link

What You Are Seeing?

Using StartProcess returns "An error occurred when executing task 'taskName'.
Error: One or more errors occurred.
The system cannot find the file specified"

StartProcess("//ComputerName/SomeFolder/Some.exe")

This same error appears when using the Powershell addin that uses a script file that invokes Start-Process.

What is Expected?

The process should be started. As it works outside of cake just using straight powershell.

What version of Cake are you using?

26.1.0

Are you running on a 32 or 64 bit system?

64

What environment are you running on? Windows? Linux? Mac?

Windows

Are you running on a CI Server? If so, which one?

Not yet, just local testing

How Did You Get This To Happen? (Steps to Reproduce)

Task("taskName")
    .Description("start exe")
    .Does(() =>
    {
        StartProcess(@"\\PCName\SomeFolder\Some.exe");
    });

Output Log

GIST LINK - Please create a gist and link to that gist here

OR

PLACE LOG CONTENT HERE

image

@devlead
Copy link
Member

devlead commented Apr 4, 2018

@jenaewhitmore Cake currently doesn't support UNC paths. Possible workarounds for this at this moment are i.e.

  1. Mount network share to drive letter
  2. Utilize cmd to start, something like StartProcess("cmd", @"/c \\PCName\SomeFolder\Some.exe");
  3. Use .NET Build in process start

@pdubb29
Copy link

pdubb29 commented Jun 27, 2018

I have a similar issue except I'm not using UNC paths.
The parameter I pass to StartProcess is like so:

var code = StartProcess("npm", 
        new ProcessSettings
        {
            Arguments = new ProcessArgumentBuilder()
                .Append("run")
                .Append("build-all-prod"),
         });

Even though I'm able to get the process to work in powershell or in any other command line I'm unable to call it in the cake build.

When I use "git" as a parameter it works as a normal shell command would.

@pdubb29
Copy link

pdubb29 commented Jun 27, 2018

I was able to get this figured out - I just pushed the npm into the arguments appended. It was able to trigger off the step I was requesting.
Now the code looks like this for those interested:

var code = StartProcess("powershell",
        new ProcessSettings
        {
            Arguments = new ProcessArgumentBuilder()
                .Append("npm")
                .Append("run")
                .Append("build-all-prod"),
         });

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

No branches or pull requests

3 participants