Browse Source

Fix bug with using COMMAND's shebang while VAR's action execution

git-svn-id: https://klish.googlecode.com/svn/trunk@532 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 12 years ago
parent
commit
ac1e4c8ffe
3 changed files with 6 additions and 6 deletions
  1. 4 5
      clish/callback_script.c
  2. 1 0
      clish/shell.h
  3. 1 1
      clish/shell/shell_execute.c

+ 4 - 5
clish/callback_script.c

@@ -21,10 +21,9 @@
 
 /*--------------------------------------------------------- */
 int clish_script_callback(clish_context_t *context,
-	const char *script, char **out)
+	clish_action_t *action, const char *script, char **out)
 {
 	clish_shell_t *this = context->shell;
-	const clish_command_t *cmd = context->cmd;
 	const char * shebang = NULL;
 	pid_t cpid = -1;
 	int res;
@@ -44,8 +43,8 @@ int clish_script_callback(clish_context_t *context,
 		return BOOL_TRUE;
 
 	/* Find out shebang */
-	if (cmd)
-		shebang = clish_action__get_shebang(clish_command__get_action(cmd));
+	if (action)
+		shebang = clish_action__get_shebang(action);
 	if (!shebang)
 		shebang = clish_shell__get_default_shebang(this);
 	assert(shebang);
@@ -159,7 +158,7 @@ int clish_script_callback(clish_context_t *context,
 
 /*--------------------------------------------------------- */
 int clish_dryrun_callback(clish_context_t *context,
-	const char *script, char ** out)
+	clish_action_t *action, const char *script, char ** out)
 {
 #ifdef DEBUG
 	fprintf(stderr, "DRY-RUN: %s\n", script);

+ 1 - 0
clish/shell.h

@@ -152,6 +152,7 @@ typedef void clish_shell_cmd_line_fn_t(
   */
 typedef int clish_shell_script_fn_t(
 	clish_context_t *context,
+	clish_action_t *action,
 	const char *script,
 	char **out);
 

+ 1 - 1
clish/shell/shell_execute.c

@@ -346,7 +346,7 @@ int clish_shell_exec_action(clish_action_t *action,
 			lub_argv_delete(argv);
 	} else if (script) {
 		/* now get the client to interpret the resulting script */
-		result = this->client_hooks->script_fn(context, script, out);
+		result = this->client_hooks->script_fn(context, action, script, out);
 	}
 	lub_string_free(script);