2012-11-26 3 views
0

컨트롤러에서 호출하는 모델 메서드에 다음 코드가 있습니다. jruby 코드를 통해 실행되는 curl 명령을 중지하는 방법은 무엇입니까?

Kernel.system"curl -H "Content-Type:application/json" -d "{\"party\":{\"lock_version\":\"0\",\"party_type\":\"Customer\",\"name\":\"xxxxx\",\"sub_type\":\"\",\"description\":\"\",\"contacts_attributes\":{\"1\":{\"name\":\"Jy\",\"email\":\"[email protected]\",\"is_default\":\"true\",\"_destroy\":\"0\"}}}}" "http://localhost:3000/company/customers?auth_token=BhD7P6sXkHkNwVVXx3TF""

상기 코드가 실행

는 콘솔 난 볼 수있다.

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 202 0 0 0 202 0 0 --:--:-- 0:04:13 --:--:-- 0

하지만, 위의 과정은 내가 종료 내 서버 CTRL+c 내가 내 콘솔에 다음 줄을 볼 수 있습니다 사용 얼른 계속합니다.

Started POST "/company/customers?auth_token=BhD7P6sXkHkNwVVXx3TF" for 127.0.0.1 at Mon Nov 26 05:24:13 +0000 2012 Processing by PartiesController#create as JSON Parameters: {"party"=>{"lock_version"=>"0", "party_type"=>"Customer", "name"=>"xxxxx", "sub_type"=>"", "description"=>"", "contacts_attributes"=>{"1"=>{"name"=>"Jy", "email"=>"[email protected]", "is_default"=>"true", "_destroy"=>"0"}}}, "auth_token"=>"BhD7P6sXkHkNwVVXx3TF", "party_type"=>"Customer"} WARNING: Can't verify CSRF token authenticity

customer가 성공적으로 curl을 사용하고 있다는 것을 의미한다.

그러나 왜 내 서버를 종료 한 다음 curl 명령의 결과를 보려면 inorder를 다시 시작해야합니까?이 문제에 대한 해결책이 있습니까? 아니면 잘못된 것이 있습니까?

도와주세요.

감사합니다.

답변

0

내 질문에 대한 답변을 얻었습니다. 명령 실행 시간을 제한하는 -m 명령을 사용해야했습니다.

그래서 지금 내가 종료 내 서버에 필요하지 않습니다 ... 3 초 동안 실행됩니다

Kernel.system"curl -m 3 -H "Content-Type:application/json" -d "{\"party\":{\"lock_version\":\"0\",\"party_type\":\"Customer\",\"name\":\"xxxxx\",\"sub_type\":\"\",\"description\":\"\",\"contacts_attributes\":{\"1\":{\"name\":\"Jy\",\"email\":\"[email protected]\",\"is_default\":\"true\",\"_destroy\":\"0\"}}}}" "http://localhost:3000/company/customers?auth_token=BhD7P6sXkHkNwVVXx3TF""

. :-)

같은