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

Tasks fail to run on networked locations #48351

Closed
rbenson opened this issue Apr 22, 2018 · 16 comments
Closed

Tasks fail to run on networked locations #48351

rbenson opened this issue Apr 22, 2018 · 16 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues
Milestone

Comments

@rbenson
Copy link

rbenson commented Apr 22, 2018

My workplace maps the Documents folder to a networked location, so it's automatically backed up. So it looks like C:\Users\Username\documents it is really \\domain\server\username\documents. My tasks.json is below. If I run my task in a networked directory (ex \\domain\server\username\documents\md_test), I get a "Failed to create terminal for task Convert to markdown" error. If I make the same directory structure in my user folder, C:\Users\username, or my desktop, the task runs fine.

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "Convert to markdown",
                "type": "shell",
                "command": "markdown-it \"${file}\" -o \"${fileBasenameNoExtension}\".html",
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "problemMatcher": []
            }
        ]
    }

OS: Win 10 Enterprise 64 bit
VSC: 1.2.2

@vscodebot vscodebot bot added the tasks Task system issues label Apr 22, 2018
@dbaeumer dbaeumer added the terminal Integrated terminal issues label Apr 23, 2018
@dbaeumer
Copy link
Member

@Tyriar are there any restrictions in terms if UNC paths. When executing the task the task system will use the UNC folder as the cwd.

@rbenson can you try one work around. Set

"options": {
	"cwd": "C:\\"
}

to see if the task runs successful or not.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Apr 23, 2018
@rbenson
Copy link
Author

rbenson commented Apr 23, 2018

@dbaeumer The task still failed, though that caused the terminal to popup, where it didn't before. I tried setting cwd to the directory of my markdown files, but that didn't work.

The terminal is blank.

@Tyriar
Copy link
Member

Tyriar commented Apr 23, 2018

@Tyriar are there any restrictions in terms if UNC paths. When executing the task the task system will use the UNC folder as the cwd.

@dbaeumer I've never tested the terminals on network drives.

@rbenson
Copy link
Author

rbenson commented Apr 24, 2018

@Tyriar I just looked, the terminal shows the correct path. I did ls, cd .., and code . and they all worked as expected, though ls and code . took maybe 2 seconds to do it.

@dbaeumer dbaeumer added bug Issue identified by VS Code Team member as probable bug and removed terminal Integrated terminal issues info-needed Issue requires more information from poster labels Apr 25, 2018
@dbaeumer
Copy link
Member

I found the problem. CMD.EXE doesn't support starting with an UNC path as the cwd. I have code to check this but that one doesn't only check for Windows. Need to make this cmd.exe specific.

@rbenson I assume you are using PowerShell. Right ?

@dbaeumer dbaeumer added this to the April 2018 milestone Apr 25, 2018
@dbaeumer
Copy link
Member

To verify you need to have a workspace on a UNC drive. You can share some folder of your Windows machine and then use it using UNC path \localhost\sharedFolder. @bpasero may be you can verify since you know how that trick works.

@rbenson
Copy link
Author

rbenson commented Apr 25, 2018

@dbaeumer No - I am using bash. I made a workspaces directory in the root of my Documents directory (moved from C:\Users\Name.vscode\workspace to \\domain\server\username\documents\vscWorkspaces), and the task still failed. Setting the terminal to PS, the task still fails.

Please reopen

@dbaeumer
Copy link
Member

I fixed it yesterday so you need to either test this with insiders from today or wait until we ship the next stable. As said it didn't work with PowerShell either since the old code checked for Windows not for Windows & cmd.exe.

Regarding bash: task and bash are not well supported under Windows. Major problem here is that VS Code assume that when running under Windows \ and drive letters are used. We are looking into making this work nicer.

@rbenson
Copy link
Author

rbenson commented Apr 26, 2018

Thanks for that. I don't haves the privs to enable insders, so I'll keep a look out for the patch.

@roblourens
Copy link
Member

Does this fix the scenario or just add a warning? I see the new warning when using cmd and running the vscode build task without cwd customized on the task. In other cases, I just see a terminal error message.

  • Open \\localhost\c$\Users\roblou\vscode
  • Terminal is powershell, run build task
  • The terminal process terminated with exit code: 1
  • Same if I set "cwd": "c:\\"

cmd

  • Terminal is cmd.exe, run build task
  • Can't execute a shell command on an UNC drive using cmd.exe.
  • If I set "cwd": "c:\\", The terminal process terminated with exit code: 4294963238

Also, lots of errors from task detection.

@dbaeumer
Copy link
Member

UNC paths aren't supported under CMD.EXE so the warning is expected. The are under PowerShell to my knowledge. I will reopen and will check again.

@roblourens for the first case could you open a terminal ?

@dbaeumer dbaeumer reopened this Apr 27, 2018
@dbaeumer dbaeumer modified the milestones: April 2018, May 2018 Apr 27, 2018
@roblourens
Copy link
Member

Yes, it looks like
image

@dbaeumer dbaeumer modified the milestones: May 2018, June 2018 May 30, 2018
@dbaeumer
Copy link
Member

Need to move the issue.

@dbaeumer dbaeumer removed this from the June 2018 milestone Jun 26, 2018
@dbaeumer dbaeumer added this to the On Deck milestone Jun 26, 2018
@dbaeumer
Copy link
Member

@alexr00 something to investigate again.

@alexr00
Copy link
Member

alexr00 commented Oct 29, 2018

I ran this task and it worked (echoed "testing'):

{
    label": "testTask",
    "type": "shell",
    "command": "echo testing",
    "options": {
        "cwd": "\\\\HOST\\Newfolder",
        "shell": {
            "executable": "powershell.exe"
        }
    }
}

When I tried it with cmd.exe as the shell I saw the error about using UNC drives with cmd.exe.

It doesn't look like there's a bug here now 😊

@alexr00 alexr00 closed this as completed Oct 29, 2018
@dbaeumer
Copy link
Member

@alexr00 thanks for trying to reproduce.

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues
Projects
None yet
Development

No branches or pull requests

5 participants