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

Duplicate Files Using Standard Input #13

Open
mattcargile opened this issue Jun 8, 2022 · 1 comment
Open

Duplicate Files Using Standard Input #13

mattcargile opened this issue Jun 8, 2022 · 1 comment

Comments

@mattcargile
Copy link

mattcargile commented Jun 8, 2022

File generated in $env:Temp isn't opened by VS Code. code.exe still generates its own file when doing 'hello world' | Invoke-VSCode -

Maybe $inputobjects can be piped directly in somehow? I'd like to avoid the file generate in $env:Temp. Below is the code section I'm talking about.

$pipeTempPath = (join-path $env:TEMP ("pscode-stdin-{0}.txt" -f [System.GUID]::NewGuid().ToString()))
Write-Verbose "Writing out piped input to file $pipeTempPath"
$inputObjects | out-file $pipeTempPath -Encoding ascii
Start-Process -FilePath $codePath -ArgumentList $codeArgs -RedirectStandardInput $pipeTempPath

@wtjones
Copy link
Owner

wtjones commented Jun 9, 2022

This is due to Start-Process not taking stdin directly but through -RedirectStandardInput via a file. There is a way to wrap and capture to $Input:
"foo" | Powershell -Command "Start-Process bash -ArgumentList $Input" ... however this only helps with args.

I'm not aware of another way to do it, but I'm open to suggestions.

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

2 participants