chuck icon indicating copy to clipboard operation
chuck copied to clipboard

chuck shell does not work on Windows (cygwin and cmd; but in different ways)

Open gewang opened this issue 2 years ago • 1 comments

ChucK shell (1.4.1.0) does not appear to work on windows 10. Cygwin, after invoking "chuck --shell" the prompt hangs; on the windows command prompt (cmd), the ChucK shell prompt is displayed, but cannot seem to run any code (e.g., > { <<< 1 >>>; } seems to exit/crash without actually running the code.

NOTE: This would be nice to fix as the shell can be useful for a number of things, including quick access to .help().

gewang avatar Apr 27 '22 22:04 gewang

@gewang: I just checked this out on my local windows build and found it seems to work with one caveat (below). Since it's my local build (using vc17 or vc22) your issues may be orthogonal/unrelated.

  • my build appears to work in the git-bash shell and regular command prompt..
  • BUT if I just hit return with no content I get a crash on chuck_shell.cpp: line 463
if( !code_entry_active && in[in.find_first_not_of( " \t\v\n" )] == '{' )

Fix for empty-string might be as simple as:

if( !code_entry_active)
{
   int ii = in.find_first_not_of("\t\v\n");
   if(ii >= 0 && in[ii] == '{') etc.
}

I wasn't familiar with chuck --shell, but here's some sample output that I see (when non-zero inputs are provide):

% chuck --shell
welcome to chuck shell!
chuck %> { <<< 1 >>>; }
[chuck](VM): sporking incoming shred: 1 (cks5693.tmp)...
chuck %> 1 :(int)
{ <<< 2, "hrm" >>>; }
chuck %> [chuck](VM): sporking incoming shred: 1 (cks918A.tmp)...
2 hrm

dbadb avatar Jan 07 '23 21:01 dbadb