can't use JS eval trick from inside function because of JS scoping

This commit is contained in:
Eliot Horowitz
2009-06-11 20:15:31 -04:00
parent 7c8f6d5b1c
commit 8b6145546a
2 changed files with 13 additions and 28 deletions

View File

@@ -307,23 +307,22 @@ int main(int argc, char* argv[]) {
break;
}
/*
bool wascmd = false;
{
string cmd = line;
if ( cmd.find( " " ) > 0 )
cmd = cmd.substr( 0 , cmd.find( " " ) );
if ( shellHelper->HasRealNamedProperty( v8::String::New( cmd.c_str() ) ) ){
stringstream ss;
ss << "shellHelper( \"" << cmd << "\" , \"" << code.substr( cmd.size() ) << "\" )";
code = ss.str();
scope->exec( (string)"__iscmd__ = shellHelper[\"" + cmd + "\"];" , "(shellhelp1)" , false , true , true );
if ( scope->getBoolean( "__iscmd__" ) ){
scope->exec( (string)"shellHelper( \"" + cmd + "\" , \"" + code.substr( cmd.size() ) + "\");" , "(shellhelp2)" , false , true , false );
wascmd = true;
}
}
*/
scope->setString( "__line__" , code.c_str() );
scope->exec( "execShellLine()" , "(shell)" , true , true , false);
if ( ! wascmd )
scope->exec( code.c_str() , "(shell)" , true , true , false );
shellHistoryAdd( line );