2013-04-18 5 views
0

여기 백엔드 코드의 res.end에서 수신 : 나는 터미널에서 컬 때이상한 후행 문자

res.statusCode = 400 
res.setHeader 'Content-Type', 'text/plain' 
res.end 'Invalid API endpoint.' 

, 내가 얻을 :

Invalid API endpoint.% 

은 "%"기호가 반전 된 색상으로 표시됩니다 .

왜 "%"기호가 있습니까?

답변

2

응답 송신에 후행 줄 바꿈이 없기 때문에이 부분 행을 표시합니다.

man zshoptions 
PROMPT_SP <D> 
      Attempt to preserve a partial line (i.e. a line that did not 
      end with a newline) that would otherwise be covered up by the 
      command prompt due to the PROMPT_CR option. This works by out‐ 
      putting some cursor-control characters, including a series of 
      spaces, that should make the terminal wrap to the next line 
      when a partial line is present (note that this is only success‐ 
      ful if your terminal has automatic margins, which is typical). 
  When a partial line is preserved, by default you will see an 
      inverse+bold character at the end of the partial line: a "%" 
      for a normal user or a "#" for root. If set, the shell parame‐ 
      ter PROMPT_EOL_MARK can be used to customize how the end of 
      partial lines are shown. 

      NOTE: if the PROMPT_CR option is not set, enabling this option 
      will have no effect. This option is on by default. 
+0

에서 감사합니다! 그런데 텍스트/일반 응답에 후행 줄 바꿈을 추가해야합니까? – Max

+0

전적으로 어떻게 사용되는지에 달려 있습니다. –

+0

지금은 "Invalid API endpoint"와 같이 인간이 읽을 수있는 간단한 일반 텍스트 메시지 만 보내고 싶습니다. – Max