anchor.diff:        {ok, PidFilename, PidIo} = temp_file(),
         file:close(PidIo),
         
  -      {Pid, Ref, Tag} = async_command("/bin/sh", [ScriptFilename], [{pidfile, PidFilename}|to_proplist(BeeObject)], From),
  +      {Pid, Ref, Tag} = async_command("/bin/sh", [ScriptFilename], BeeDir, [{pidfile, PidFilename}|to_proplist(BeeObject)], From),
         timer:sleep(500),
         OsPid = read_pid_file_or_retry(PidFilename, 50),
         file:delete(PidFilename),
  
positive.code:   end.
  
  % Synchronus command
  cmd(Str, Envs, From) ->
    [Exec|Rest] = string:tokens(Str, " "),
    case catch cmd(Exec, Rest, Envs, From) of
      {'EXIT', T} -> {error, T};
      E -> E
    end.
  
  cmd(Cmd, Args, Envs, From) ->
    {Pid, Ref, Tag} = async_command(Cmd, Args, Envs, From),
    receive
      {'DOWN', Ref, process, Pid, {Tag, Data}} -> Data;
      {'DOWN', Ref, process, Pid, Reason} -> exit(Reason)
    end.
  
  async_command(Cmd, Args, Envs, From) ->
    Tag = make_ref(), 
    {Pid, Ref} = erlang:spawn_monitor(fun() ->
      Rv = cmd_sync(Cmd, Args, build_envs(Envs), From),
      exit({Tag, Rv})
    end),
    {Pid, Ref, Tag}.
  
  cmd_sync(Cmd, Args, Envs, From) ->
    P = open_port({spawn_executable, os:find_executable(Cmd)}, [
      binary, stderr_to_stdout, use_stdio, exit_status, stream, eof, {args, Args}, {env, Envs}
      ]),
    cmd_receive(P, [], From, undefined).
  
  
negative.code:   
  % Run a command in the directory
  run_command_in_directory(Cmd, Dir, From, BeeObject) ->
    ?DEBUG_PRINT({run_command_in_directory, Dir, Cmd, From}),
    cmd(Cmd, Dir, to_proplist(BeeObject), From).
  
  % Run file
  run_in_directory_with_file(_BeeObject, _From, _Dir, undefined) -> ok;
  