2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

NodObjCでNSLogを任意のファイルに出力する

Last updated at Posted at 2014-02-03

Node.jsでCocoa APIが叩けるNodObjC

近況

node-webkitと悪魔合体を密かに試みて、ビルド出来るところまで行ったのですが、しばらくすると、
終了してしまう現象が解決できずにいます。

本題

ファイルディスクリプタ番号2を閉じることで、NSLogの出力を任意のファイルに出力できる。

fs.closeSync(2)
var fd = fs.openSync("foobar.log", 'w')

$.NSLog($("NSLogのテスト"))

まとめ

先日MacRubyがMavericksで動かせそうになってきた記事をみて、そっちに移りそうなので、
node.jsベースで覚えたことを忘れない為に、ここにメモを残しました。

この応用で、ファイルディスクリプタ番号1をクローズすれば、標準出力を任意のファイルに落とせるんだろうが、
リダイレクトでいいからなぁ。。。

Link

関連記事

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?