Comments (6)
Hey @Tyrrrz thanks for digging into this. I did place an issue with Microsoft about this, so we'll see what they say.
from cliwrap.
Does that program consume stdin for anything? I think this happens because CliWrap always redirects all standard streams, and some programs may infer that if stdin is redirected, then the user intends to write something to it.
I'm not familiar with SqlPackage
but maybe there's an argument you can pass to explicitly disable that behavior. Otherwise, you can try passing PipeSource.FromStream(Stream.Null)
for the standard input pipe, but it will probably just result in a different error.
Also see #190, which might be a similar issue.
from cliwrap.
Hey @Tyrrrz thanks for the quick response! I did try handling the standard input in that way but I got the same result. I don't believe that SqlPackage bothers with standard input anyway; none of the docs indicate that you can pipe to it.
Attached here is a simple project that shows the failure. Just use the dotnet command below to install SqlPackage, and then run this project. You can easily uninstall SqlPackage with the same command and the word "uninstall" instead of "install".
dotnet tool install -g microsoft.sqlpackage
from cliwrap.
I was able to reproduce the error with the following minimal code:
using var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "sqlpackage",
RedirectStandardOutput = true,
RedirectStandardError = true
}
};
process.OutputDataReceived += (sender, args) =>
{
if (args.Data is not null)
{
Console.WriteLine(args.Data);
}
};
process.ErrorDataReceived += (sender, args) =>
{
if (args.Data is not null)
{
Console.WriteLine(args.Data);
}
};
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
Note that the error appears to only happen when both the output and error streams are redirected, but not when only one of them is.
All in all, this looks like either a bug within the Process
class or inside the implementation of SqlPackage
(which is more likely). I would recommend raising an issue with them, using the code snippet above. Since this issue is not specific to CliWrap (seeing as it's reproducible with raw Process
), I'm going to close it.
from cliwrap.
Hey @Tyrrrz I just got this update from Microsoft:
"This is fixed and will be in the August release. Let me know if you want to try it out earlier and we can release a preview version of Microsoft.SqlPackage."
Just thought you would want to know.
from cliwrap.
Great! @argentini
from cliwrap.
Related Issues (20)
- Invalid encoding when running a specific executable on Windows HOT 4
- Possibility to not redirect certain process streams HOT 4
- Cannot be used in IIS? HOT 6
- Stdout and stderr order not preserved HOT 10
- Support intermediate pipe handlers to transform output from one command into input for another HOT 11
- Not getting the proper response from docker command HOT 5
- Add `WithArguments` overload (or new method) that allows appending arguments to an existing command HOT 2
- Command can deadlock if the process writes large output and one of the targets inside `PipeTarget.Merge(...)` throws
- Problem with stdOut HOT 8
- When using .NET Framework instead of .NET Core, there are problems with stdin encoding HOT 10
- UnicodeEncodeError when Python program outputs unicode HOT 4
- Allow forced argument escaping HOT 5
- Allow input midway through a script's execution HOT 5
- Option to allocate a pseudo-terminal for running command-line applications HOT 1
- `telnet` command is throwing 'No such file or directory' error HOT 4
- Argument Escaping HOT 1
- Ignore waiting for output stream when main process is finished, but it has active children reusing the same output streams HOT 1
- ExecuteBufferedAsync - Access a merged Stdout and Sterror HOT 1
- Ask for the "PrivacyInfo.xcprivacy" required by Apple HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cliwrap.