AutoBuildMarlin icon indicating copy to clipboard operation
AutoBuildMarlin copied to clipboard

Build success but always recieve message 'Access to path is denied'

Open s-marley opened this issue 3 years ago • 4 comments

Once the build is successful I get the following output:

image

I think the issue might be that there is a space in the name of my home directory so it is truncating the path to C:\Users\Scott which of course isn't a real path. Perhaps missing some quotes somewhere?

s-marley avatar Jul 18 '21 20:07 s-marley

Once the build is successful I get the following output:

image

I think the issue might be that there is a space in the name of my home directory so it is truncating the path to C:\Users\Scott which of course isn't a real path. Perhaps missing some quotes somewhere?

Paul3899 avatar Aug 24 '21 16:08 Paul3899

Is it legal to wrap the entire path in double-quotes in your configured shell? The current logic applies single quotes to the path, but only for the bash shell:

  if (process.platform == 'win32') {
    t.sendText(cmdline);
    var cmd = `echo "done" >${ipc_file}`;
    if (vscode.env.shell.indexOf('bash') != -1)
      cmd = `echo "done" >'${ipc_file}'`;
    if (ping) t.sendText(cmd);
  }
  else
    t.sendText(cmdline + (ping ? ` ; echo "done" >|${ipc_file}` : ''));

Perhaps there is a standardized method provided by node.js for path formatting in this context. Otherwise we can just try always wrapping in double-quotes, like so:

  if (process.platform == 'win32') {
    t.sendText(cmdline);
    var cmd = `echo "done" >"${ipc_file}"`;
    if (vscode.env.shell.indexOf('bash') != -1)
      cmd = `echo "done" >'${ipc_file}'`;
    if (ping) t.sendText(cmd);
  }
  else
    t.sendText(cmdline + (ping ? ` ; echo "done" >|"${ipc_file}"` : ''));

thinkyhead avatar Aug 27 '21 21:08 thinkyhead

I am getting a similar error on MacOS using Fish Shell. The build completes just fine, but the echo "done" is failing. If its a different root cause, I can open up a new bug.

image

jbryson3 avatar Mar 23 '22 17:03 jbryson3

I am getting a similar error on MacOS using Fish Shell.

I have some new rough logic in the works, hopefully about correct, but maybe you can verify…

const sh = vscode.env.shell,
      isbash = sh.indexOf('bash') >= 0,
      iszsh = sh.indexOf('zsh') >= 0,
      iscmd = sh.indexOf('cmd') >= 0,
      ispwsh = sh.search(/(powersh|pwsh)/i) >= 0,
      iswin = process.platform == 'win32',
      p = iscmd ? '&' : ';',
      q = iswin && isbash ? "'" : '"',
      r = (isbash || iszsh) ? '>|' : '>';
ping_cmd = `${p} echo "done" ${r}${q}${ipc_file}${q}`;
  • For standard Windows command-line (CMD) the command separator is & – otherwise use ;.
  • For Windows BASH the path is wrapped in double-quotes.
  • For all others the path is wrapped in single-quotes.
  • For BASH or ZSH the redirect is >| otherwise it is just >.

thinkyhead avatar May 21 '22 04:05 thinkyhead

The above code will be added to 2.1.51. If the issue isn't fixed in that release, open a new one.

thinkyhead avatar Dec 28 '23 02:12 thinkyhead