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

Error occurs when running a script that uses Console.Readkey / ReadLine #6

Open
glennblock opened this issue Mar 7, 2013 · 4 comments
Labels

Comments

@glennblock
Copy link
Contributor

Found package reference: C:\code\scriptcs\samples\servicestackhost\packages\ServiceStack.3.9.37\lib\net35
Found package reference: C:\code\scriptcs\samples\servicestackhost\packages\ServiceStack.Common.3.9.37\lib\net35
Found package reference: C:\code\scriptcs\samples\servicestackhost\packages\ServiceStack.Redis.3.9.37\lib\net35
Found package reference: C:\code\scriptcs\samples\servicestackhost\packages\ServiceStack.Text.3.9.37\lib\net35
listening on http://*:999/

Unhandled Exception: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.
   at System.Console.ReadKey(Boolean intercept)
   at Submission#0..ctor(Session session, Object& submissionResult)
   at Submission#0.<Factory>(Session session)
   at Roslyn.Scripting.CommonScriptEngine.Execute[T](String code, String path, DiagnosticBag diagnostics, Session session, Boolean isInteractive)
   at Roslyn.Scripting.Session.Execute(String code)
   at ScriptCs.Wrappers.SessionWrapper.Execute(String code) in c:\code\scriptcs\src\ScriptCs.Core\Wrappers\SessionWrapper.cs:line 17
   at ScriptCs.ScriptExecutor.Execute(String script, IEnumerable`1 paths, IEnumerable`1 scriptPacks) in c:\code\scriptcs\src\ScriptCs.Core\ScriptExecutor.cs:line 47
   at ScriptCs.Program.Main(String[] args) in c:\code\scriptcs\src\ScriptCs\Program.cs:line 28
[Finished in 10.6s]

Looks like a buffer needs to be passed the process.

@follesoe
Copy link
Contributor

I think there are some limitations to setting stdin to build-processes in Sublime Text. However, this plug-in - https://github.com/eric-wieser/build-with-input - enables build with input. I will try the plugin in conjunction with scriptcs some time this week and see if it is doable.

For REPL-style programming (or scripts where you need input) Sublime-REPL is commonly used.

@glennblock
Copy link
Contributor Author

Great, thanks Jonas!

On Sun, Mar 10, 2013 at 12:46 PM, Jonas Follesø [email protected]:

I think there are some limitations to setting stdin to build-processes in
Sublime Text. However, this plug-in -
https://github.com/eric-wieser/build-with-input - enables build with
input. I will try the plugin in conjunction with scriptcs some time this
week and see if it is doable.

For REPL-style programming (or scripts where you need input) Sublime-REPL
is commonly used.


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-14687768
.

@follesoe
Copy link
Contributor

I tried the build-with-input pligin, and it works for Console.ReadLine() and Console.Read(), but not Console.ReadKey() - I still get the exception you reported.

I do think this is a limitation to the build system in Sublime Text. I will investigate further when I find time to see if this has been solved in other, more popular language plugins (such as Ruby).

@luisrudge
Copy link

any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants