0
我有一個接受幾個參數的Ruby腳本,其中一個參數是時間戳。在調用腳本時將Ruby傳遞時間戳作爲參數
# Basically this timestamp is getting from database and I just use Time.now for testing purpose
local_timestamp = Time.now.utc
#{name} #{id} {local_timestamp}"
runcmd = "/home/test.rb"
fork { exec(runcmd) }
但是,當它運行的時間戳參數沒有正確採取,它只是採取Mon
只。
我試圖通過這個參數,因爲local_timestamp.to_s
也產生了相同的錯誤。
'exec'創建一個新的進程,不知道你當前執行的程序什麼。您可能只想使用複製當前上下文的fork。 – Koraktor
你爲什麼要'fork' /'exec'而不是'system'? – tadman