小编jer*_*tbt的帖子

Future.wait()不能没有光纤等待(等待Meteor.method中的另一个未来)

Meteor,我正在编写一个方法,必须检查某个路径的子目录的新文件.我首先想列出其中的子目录,Meteor之后是child_process.exec一个简单的bash脚本,列出自上次执行以来添加的文件.

我在将目录发现设置为async(Error: Can't wait without a fiber)时遇到了一些问题.我已经编写了一个同步版本但是同时使用它们fs.readdirfs.stat不是它们的同步替代版本允许我捕获错误.

这是代码:

function listDirs(dir, isDir){

    var future1 = new Future();fs.readdir(dir, function(err, files){

            if (err)
                throw new Meteor.error(500, "Error listing files", err);

            var dirs = _.map(files, function(file){

                var future2 = new Future();
                var resolve2 = future2.resolver();

                fs.stat(dir+file, function(err, stats){

                    if (err)
                        throw new Meteor.error(500, "Error statting files", err);

                    if (stats.isDirectory() == isDir && file.charAt(0) !== '.')
                        resolve2(err, file);

                });

                return future2;

            });

            Future.wait(dirs); …
Run Code Online (Sandbox Code Playgroud)

future meteor

7
推荐指数
1
解决办法
3639
查看次数

emacs Flycheck"无法使用已配置的语法检查程序python-flake8"

这里有新的emacs/python用户.
我正努力开始flycheck工作(和使用flake8).

这是我的相关部分init.el:

(require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py$" . python-mode))
(add-hook 'python-mode-hook 'flycheck-mode)
Run Code Online (Sandbox Code Playgroud)

当我打开python文件时,我的模式行包括Py FlyC-
From the Flycheck手册,我了解到这意味着Flycheck无法自动找到合适的检查器.

当我运行M-x flycheck-select-checker并选择python-flake8它返回:

Configured syntax checker python-flake8 cannot be used
Run Code Online (Sandbox Code Playgroud)

我正在使用OSX 10.9 homebrew和这些版本:

$ emacs --version
GNU Emacs 24.3.50.1
$ flake8 --version
2.1.0 (pep8: 1.4.6, pyflakes: 0.7.3, mccabe: 0.2.1) CPython 2.7.5 on Darwin
$ which flake8
/usr/local/bin/flake8
$ python --version
Python 2.7.5
$ which python
/usr/local/bin/python …
Run Code Online (Sandbox Code Playgroud)

python macos emacs homebrew flycheck

6
推荐指数
1
解决办法
4019
查看次数

标签 统计

emacs ×1

flycheck ×1

future ×1

homebrew ×1

macos ×1

meteor ×1

python ×1